package com.cloudcc.mobile.dao.impl;

import java.net.URLEncoder;

import com.cloudcc.mobile.AppContext;
import com.cloudcc.mobile.dao.AddMicroPostDao;
import com.cloudcc.mobile.util.NetWork;
import com.cloudcc.mobile.util.Tools;
import com.cloudcc.mobile.util.UrlTools;

public class AddMicroPostDaoImpl implements AddMicroPostDao {
	/** * 普通 帖子 */
	@Override
	public String addMicroPostF(String data) {
		String json = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");
			String url = UrlTools.url + UrlTools.url_path
					+ "serviceName=addMicroPostF&data=" + Data + "&binding="
					+ AppContext.binding;
			json = NetWork.get(url.trim());
		} catch (Exception e) {
			Tools.handle(e);
		}
		return json;
	}

	/** * 文件 帖子 */
	@Override
	public String addMicroPostD(String data) {
		String json = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");
			String url = UrlTools.url + UrlTools.url_path
					+ "serviceName=addMicroPostD&data=" + Data + "&binding="
					+ AppContext.binding;
			json = NetWork.get(url.trim());
		} catch (Exception e) {
			Tools.handle(e);
		}
		return json;
	}

	/** * 链接帖子 */
	@Override
	public String addMicroPostL(String data) {
		String json = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");
			String url = UrlTools.url + UrlTools.url_path
					+ "serviceName=addMicroPostL&data=" + Data + "&binding="
					+ AppContext.binding;
			json = NetWork.get(url.trim());
		} catch (Exception e) {
			Tools.handle(e);
		}
		return json;
	}

	@Override
	public String addMicroPost(String data) {
		String json = "";
		try {
			String Data = URLEncoder.encode(data, "utf-8");
			String url = UrlTools.url + UrlTools.url_path + "serviceName="
					+ AppContext.ADDMICROPOST + "&data=" + Data + "&binding="
					+ AppContext.binding;
			json = NetWork.get(url.trim());
		} catch (Exception e) {
			Tools.handle(e);
		}
		return json;
	}

}
